<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>更新楼宇信息</title>
    <style>
        body, html {
            margin: 0;
            padding: 0;
            font-family: Arial, sans-serif;
        }
        .header {
            background-color: #007BFF;
            color: white;
            padding: 10px;
            text-align: center;
        }
        .sidebar {
            width: 200px;
            background-color: #f8f9fa;
            float: left;
            height: 100vh;
            padding-top: 20px;
        }
        .sidebar a {
            display: block;
            padding: 10px;
            text-decoration: none;
            color: black;
        }
        .sidebar a:hover {
            background-color: #ddd;
        }
        .content {
            margin-left: 210px;
            padding: 20px;
        }
        /*body {*/
        /*    font-family: 'Arial', sans-serif;*/
        /*    background-color: #f4f4f9;*/
        /*    color: #333;*/
        /*    margin: 0;*/
        /*    padding: 0;*/
        /*}*/
        h1 {
            text-align: center;
            color: #4CAF50;
        }
        .container {
            max-width: 600px;
            margin: 50px auto;
            padding: 20px;
            background-color: #fff;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        .form-group {
            margin-bottom: 15px;
        }
        label {
            display: block;
            margin-bottom: 5px;
            color: #555;
        }
        input[type="text"] {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }
        input[type="submit"] {
            width: 100%;
            padding: 10px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        input[type="submit"]:hover {
            background-color: #45a049;
        }
    </style>
</head>
<body>
<jsp:include page="/nav.jsp"/>
<div class="container">
    <h1>更新楼宇信息</h1>
    <c:forEach var="i" items="${requestScope.building}">
        <form action="buildingUpdate" method="post">
            <div class="form-group">
                <label for="buildingID">楼宇ID:</label>
                <input type="text" id="buildingID" name="buildingID" value="${i.buildingID}" required readonly>
            </div>
            <div class="form-group">
                <label for="buildingName">楼宇名称:</label>
                <input type="text" id="buildingName" name="buildingName" value="${i.buildingName}" required>
            </div>
            <div class="form-group">
                <label for="address">地址:</label>
                <input type="text" id="address" name="address" value="${i.address}" required>
            </div>
            <div class="form-group">
                <label for="totalrooms">楼宇房间数:</label>
                <input type="text" id="totalrooms" name="totalrooms" value="${i.totalRooms}" required>
            </div>
            <input type="submit" value="更新">
        </form>
    </c:forEach>
</div>
<script>
    <c:if test="${not empty message}">
    alert('${message}');
    </c:if>
</script>
</body>
</html>